<?php

namespace app\admin\controller;

use app\common\model\Blacklists;
use think\Request;

class Blacklist extends Base
{

    public function index(Request $request)
    {
        $post = $request->isAjax();
        if ($post){

            $page = input('param.page/d', 1);
            $limit = input('param.limit/d', 20);
            $data = array(
                'data'      =>  Blacklists::order('id', 'desc')->page($page)->limit($limit)->select(),
                'count'     =>  Blacklists::count('id'),
                'code'      => 0,
                'msg'       => '',
            );
            return json($data);
        }
        return view();
    }

    public function del_all_data()
    {
        if ( Blacklists::del() ){
            createLog('清空黑名单 成功');
            success('清空黑名单 成功');
        } else {
            createLog('清空黑名单 失败');
            error('清空黑名单 失败');
        }
    }

}
